import request from '@/utils/request'


/**
 * 获取企业列表
 * @export
 * @param {*} params
 * @returns {*}
 */
export function getEnterpriseListAPI(params) {
    return request({
        url: '/park/enterprise',
        params
    })
}



/**
 * 获取所属行业
 * @export
 * @param {*} 
 * @returns {*}
 */
export function getIndustryListAPI() {
    return request({
        url: '/park/industry',
    })
}

/**
 * 添加企业
 * @export
 * @param {*} data
 * @returns {*}
 */
export function addEnterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'post',
        data
    })
}


/**
 * 获取合同详情
 * @param {*} id
 * @returns
 */
export function getEnterpriseDetailAPI(id) {
    return request({
        url: `/park/enterprise/${id}`
    })
}

/**
 * 更新企业
 * @param {*} data
 * @returns
 */
export function updateExterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'PUT',
        data
    })
}


/**
 * 删除企业
 * @param {*} id
 * @returns
 */
export function deleteEnterpriseAPI(id) {
    const res = request({
        url: `/park/enterprise/${id}`,
        method: 'DELETE'
    })
    console.log('api中的结果', res)
    return res
}


export function getRengBuildingAPI() {
    return request({
        url: '/park/rent/building',
    })
}

/**
 * 添加租赁合同
 * @param {*} data
 * @returns
 */
export function addRentAPI(data) {
    return request({
        url: '/park/enterprise/rent',
        method: 'post',
        data
    })
}



/**
 * 获取展开的租赁合同
 * @param {*} id 企业id
 * @returns
 */
export function getEnterpriseRentBuildAPI(id) {
    return request({
        url: `/park/enterprise/rent/${id}`
    })
}


/**
 * 退租
 * @param {*} id 租赁合同id
 * @returns
 */
export function rentingOutAPI(id) {
    return request({
        url: `/park/enterprise/rent/${id}`,
        method: 'put'
    })
}

/**
 *删除租赁合同
 *
 * @export
 * @param {*} id 合同id
 * @return {*}
 */
export function delRentAPI(id) {
    return request({
        url: `/park/enterprise/rent/${id}`,
        method: 'DELETE'
    })
}